/*
Copyright (C) 2010 Dengwenyi

This file is part of dae2n3.

Licensed under the MIT Open Source License
*/
#include "stdneb.h"
#include "COLLADABUURI.h"
#include "DAE2Nebula3Writer.h"
#include "nebula3runtime.h"

#if defined(WIN32) && !defined(NDEBUG)
#	include <crtdbg.h> 
#endif

using namespace Models;

int main(int argc, char* argv[]) 
{

#if defined(WIN32) && !defined(NDEBUG)
	_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); 
#endif

	/// Add nebula3 runtime to project
	Ptr<Nebula3Runtime> Runtime = Nebula3Runtime::Create();
	Runtime->Setup();

	if ( argc > 2 ) 
	{

		COLLADABU::String inputFile = argv[1];
		COLLADABU::String outputFile = argv[2];

		Nebula3Writer writer( COLLADABU::URI::nativePathToUri(inputFile), COLLADABU::URI::nativePathToUri(outputFile));
		writer.write();	
	}
	else
	{
		std::cout << "You must specify an input and output file name" << std::endl;
		std::cout << "Usage: dae2n3 <inputfilename> <outputfilename>" << std::endl;
	}

	Runtime->Discard();
	Runtime = 0;
}